package com.xiaoxu.entry.bishi;

import java.util.Arrays;

public class 移动零283 {
    public static void main(String[] args) {
        int[] nums = {0,1,0,3,0,12};
         moveZero(nums);
        System.out.println(Arrays.toString(nums));
    }

    public static void moveZero(int[] nums){
        if (nums == null) return ;
        int j = 0;
        for (int i=0;i<nums.length;i++){
            if (nums[i] != 0){
                nums[j] = nums[i];
                j++;
            }
        }
        while (j < nums.length){
            nums[j++] = 0;
        }
    }
}
